package com.ushine.web.component.exception;

import com.ushine.web.component.http.HttpStatus;

/**
 * @Author: yls
 * @Date: 2022/03/03 09:57
 * @Description: 自定义service层异常
 * @Version 1.0
 */
public class ServiceException extends Exception {
    public ServiceException(BaseErrorInfoInterface baseErrorInfoInterface) {
        super(baseErrorInfoInterface.getErrorCode() + ":" + baseErrorInfoInterface.getErrorMsg());
    }

    public ServiceException(BaseErrorInfoInterface baseErrorInfoInterface, Exception e) {
        super(baseErrorInfoInterface.getErrorCode() + ":" + baseErrorInfoInterface.getErrorMsg(), e);
    }

    public ServiceException(BaseErrorInfoInterface baseErrorInfoInterface, Throwable throwable) {
        super(baseErrorInfoInterface.getErrorCode() + ":" + baseErrorInfoInterface.getErrorMsg(), throwable);
    }

    public ServiceException(String msg, Throwable throwable) {
        super(HttpStatus.SC_INTERNAL_SERVER_ERROR + ":" + msg, throwable);
    }

    public ServiceException(String msg) {
        super(HttpStatus.SC_INTERNAL_SERVER_ERROR + ":" + msg);
    }
}
